;FOLD USER DECL
; Please insert user defined declarations
    DECL EKI_STATUS RET
    DECL INT CommandRW
;ENDFOLD (USER DECL)

;FOLD USER INIT
; Please insert user defined initialization commands
    RET=EKI_Init("EdgeComputerDAQ")
    RET=EKI_Open("EdgeComputerDAQ")
    EKI_CHECK(RET,#QUIT)
    CommandRW = 0
;ENDFOLD (USER INIT)

;FOLD USER PLC
;Make your modifications here
    IF $FLAG[546] THEN
        RET = EKI_CheckBuffer("EdgeComputerDAQ","Ext/Command/UID")
        IF(RET.Buff >= 1) THEN
            REPEAT
                RET = EKI_GetInt("EdgeComputerDAQ","Ext/Command/UID", CommandRW)
            UNTIL(RET.Buff < 1)
            RET=EKI_ClearBuffer("EdgeComputerDAQ","Ext")
        ENDIF         
        SWITCH CommandRW
            CASE 1
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A1", $AXIS_ACT.A1)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A2", $AXIS_ACT.A2)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A3", $AXIS_ACT.A3)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A4", $AXIS_ACT.A4)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A5", $AXIS_ACT.A5)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/JointPos/A6", $AXIS_ACT.A6)
                RET=EKI_Send("EdgeComputerDAQ","Robot")
                CommandRW = 0
       
            CASE 2
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/X", $POS_ACT.X)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/Y", $POS_ACT.Y)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/Z", $POS_ACT.Z)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/A", $POS_ACT.A)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/B", $POS_ACT.B)
                RET=EKI_SetReal("EdgeComputerDAQ","Robot/Data/RobPos/C", $POS_ACT.C)
                RET=EKI_Send("EdgeComputerDAQ","Robot")
                CommandRW = 0
        ENDSWITCH
    ENDIF
;ENDFOLD (USER PLC)

